package com.ai.ly.goodsautocat.autocat;

import java.io.File;

import com.ai.ly.goodsautocat.util.FileUtil;

import de.bwaldvogel.liblinear.Model;

public class AutoCatModelHandler {
	
	/**
     * 把模型保存到文件中
     * @throws Exception
     * @author liangyi
     */
    public static void saveModel(Model model) throws Exception {
        File modelFile=FileUtil.getFileInSys(AutoCatConstant.modelFilePath);
        model.save(modelFile);
    }
    
    /**
     * 把文件中的模型加载到内存
     * @throws Exception
     * @author liangyi
     */
    public static Model loadModel() throws Exception {
        File modelFile=FileUtil.getFileInSys(AutoCatConstant.modelFilePath);
        Model model=Model.load(modelFile);
        return model;
    }
    
    
}
